define(["jquery","text!modules/reserve/reserve.html","modules/footer/footer","css!modules/reserve/reserve.css"],function($,html,footer){
		function render(){
		$("body").empty();
		footer.render();
		$("body").append(html);	
		//获取数据
		$.ajax({
			url:"http://www.vrserver.applinzi.com/aixianfeng/apiyuding.php",
			type:"get",
			success:function data(res){
				var data=$.parseJSON(res);
				commodity(data);
			}
		});
		//创建商品
			function commodity(data){
				var data=data.product;
				for(var i=0;i<data.length;i++){
					var img=$("<div class="+"reserve_img"+"></div>").css("backgroundImage","url("+data[i].img+")");
					var div=$("<div class="+"reserve_particular"+"><p class="+"reserve_name"+">"+data[i].name+"</p><p class="+"reserve_weight"+">"+data[i].specifics+"</p><p class="+"reserve_p"+"><span class="+"reserve_money"+">￥</span><span class="+"reserve_Nprice"+">"+data[i].price+"</span><span class="+"reserve_Oprice"+">"+data[i].market_price+"</span></p><p class="+"reserve_btn"+"></p></div>");
					$("<li/>").append(img).append(div).appendTo($(".reserve_commodity"));
				}	
				var span=$(".reserve_classify span").get();
				for(var i=0;i<span.length;i++){		
					span[i].index=i;
					span[i].addEventListener('touchstart',function(){
						$(".reserve_classify span").removeAttr("class","reserve_classify_span");
						$(this).attr("class","reserve_classify_span");
					})
				}
			}

		//页脚
		for(var i=0;i<5;i++){
		$(".footer .top").eq(i).css("backgroundImage","url(img/footer"+i+".png)");
			}	
			$(".footer .top").eq(2).css("backgroundImage","url(img/f"+2+".png)");
		
	}
	return{
		render:render
	}
})